]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Switch to using the mutter primary monitor APIs
authorAlexander Larsson <alexl@redhat.com>
Mon, 28 Feb 2011 12:50:19 +0000 (13:50 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 16 Mar 2011 19:30:58 +0000 (20:30 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=609258

js/ui/chrome.js
js/ui/main.js
js/ui/messageTray.js
src/shell-global.c

index addc9ac7db83717b35d10f9695d9c19957e703a6..32b8f04f426f1903b2f59ffdeaab5d7dfd2264a1 100644 (file)
@@ -36,8 +36,8 @@ Chrome.prototype = {
 
         this._trackedActors = [];
 
-        global.gdk_screen.connect('monitors-changed',
-                                  Lang.bind(this, this._monitorsChanged));
+        global.screen.connect('monitors-changed',
+                              Lang.bind(this, this._monitorsChanged));
         global.screen.connect('restacked',
                               Lang.bind(this, this._windowsRestacked));
 
index 3c3763bfb9c4ecb535f97c5cae57423a2566b93a..2b4c20f46643f95bd53e25c4eb2130b97922e8a1 100644 (file)
@@ -192,7 +192,7 @@ function start() {
     // Attempt to become a PolicyKit authentication agent
     PolkitAuthenticationAgent.init()
 
-    global.gdk_screen.connect('monitors-changed', _relayout);
+    global.screen.connect('monitors-changed', _relayout);
 
     ExtensionSystem.init();
     ExtensionSystem.loadExtensions();
index c105d4df640f58544e5ffe446a82fb98174d3825..5f707d400864dfbf2b28b678de153c012138dfd3 100644 (file)
@@ -1066,7 +1066,7 @@ MessageTray.prototype = {
         Main.chrome.trackActor(this._notificationBin);
         Main.chrome.trackActor(this._summaryBoxPointer.actor);
 
-        global.gdk_screen.connect('monitors-changed', Lang.bind(this, this._setSizePosition));
+        global.screen.connect('monitors-changed', Lang.bind(this, this._setSizePosition));
 
         this._setSizePosition();
 
index ab112cc0f622886ea4ecbdaa82cbf4c3365e07a7..2d55033fa53aef0eebcdadc03677a8a58e40bbdf 100644 (file)
@@ -1400,44 +1400,12 @@ shell_global_get_monitors (ShellGlobal *global)
 MetaRectangle *
 shell_global_get_primary_monitor (ShellGlobal  *global)
 {
-  GdkScreen *screen = shell_global_get_gdk_screen (global);
-  GdkRectangle gdk_rect;
+  MetaScreen *screen = shell_global_get_screen (global);
   MetaRectangle rect;
   gint primary = 0;
 
-  /* gdk_screen_get_primary_monitor is only present in gtk-2.20+
-   * and is in a useable state (supports heuristics and fallback modes)
-   * starting with 2.20.1
-   */
-#if !GTK_CHECK_VERSION (2, 20, 1)
-  gint i;
-  gchar *output_name = NULL;
-  gint num_monitors = gdk_screen_get_n_monitors (screen);
-
-  for (i = 0; i < num_monitors; i++)
-    {
-      /* Prefer the laptop's internal screen if present */
-      output_name = gdk_screen_get_monitor_plug_name (screen, i);
-      if (output_name)
-        {
-          gboolean is_lvds = g_ascii_strncasecmp (output_name, "LVDS", 4) == 0;
-          g_free (output_name);
-          if (is_lvds)
-            {
-              primary = i;
-              break;
-            }
-        }
-    }
-#else
-  primary = gdk_screen_get_primary_monitor (screen);
-#endif
-
-  gdk_screen_get_monitor_geometry (screen, primary, &gdk_rect);
-  rect.x = gdk_rect.x;
-  rect.y = gdk_rect.y;
-  rect.width = gdk_rect.width;
-  rect.height = gdk_rect.height;
+  primary = meta_screen_get_primary_monitor (screen);
+  meta_screen_get_monitor_geometry (screen, primary, &rect);
 
   return meta_rectangle_copy (&rect);
 }